//
//  ShoppingCarDetailCell.m
//  renmingongshe
//
//  Created by Mao on 2017/11/6.
//  Copyright © 2017年 xiaodian. All rights reserved.
//

#import "ShoppingCarDetailCell.h"

@implementation ShoppingCarDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)cellConfig:(NSDictionary *)data
{
    [_goodsIma sd_setImageWithURL:[NSURL URLWithString:[Utils getImaSting:data[@"goodsImg"]]] placeholderImage:[UIImage imageNamed:@"NoStore"] options:SDWebImageRetryFailed];
    _goodsName.text = data[@"goodsName"];
    
    _goodsPrice.text = [NSString stringWithFormat:@"￥%.1f",![TXUtilsString isBlankString: data[@"shopPrice"]]?[data[@"shopPrice"]floatValue]:0.0];
    
    NSString *str;
    if (![TXUtilsString isBlankString:data[@"goodsSpec_pv"]]) {
        str = [NSString stringWithFormat:@"分润点 %.2f",[data[@"goodsSpec_pv"]floatValue]];
    }else{
        str = [NSString stringWithFormat:@"分润点 %.2f",[data[@"goods_pv"]floatValue]];
    }
    _point.text = str;
    _num.text = [NSString stringWithFormat:@"数量 %@",data[@"cartNum"]];
    
    if ([data[@"specsName"]count]) {
        NSArray *arr = data[@"specsName"];
        NSMutableArray *a = [NSMutableArray array];
        
        for (NSDictionary *d in arr) {
            [a addObject:d[@"itemName"]];
        }
        _specName.text = [a componentsJoinedByString:@" "];
    }else{
        _specName.text = @"";
    }
}

@end
